package com.weayer.controller;

import com.weayer.dto.OrderInfo;
import com.weayer.mapper.OrderInfoMapper;
import com.weayer.service.OrderInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: 测试类
 * @author: Weayer
 **/
@RestController
public class TestController {
    @Autowired
    OrderInfoService orderInfoService;
    @Autowired
    OrderInfoMapper orderInfoMapper;

    @Value("${server.port}")
    String port;

    @GetMapping("/test-dispatch-real-time-order/{orderId}")
    public String dispatchRealTimeOrder(@PathVariable("orderId") long orderId){
        System.out.println("并发测试 orderId：" + orderId + " port：" + port);
        OrderInfo orderInfo = orderInfoMapper.selectById(orderId);
        orderInfoService.dispatchRealTimeOrder(orderInfo);
        return "test success";
    }
}
